package com.itfreer.demo.configuration;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.quartz.SchedulerFactoryBean;

import com.itfreer.jwt.security.IPSecurityCheck;
import com.itfreer.jwt.security.RefererSecurityCheck;
import com.itfreer.jwt.security.UserAgentSecurityCheck;

/**
 * 跨域请求
 */
@Configuration
public class JwtConfiguration {

	@Bean(name = "jwtScheduler")
	public SchedulerFactoryBean schedulerFactory() {
		SchedulerFactoryBean bean = new SchedulerFactoryBean();
		// 用于quartz集群,QuartzScheduler 启动时更新己存在的Job
		bean.setOverwriteExistingJobs(true);
		// 延时启动，应用启动1秒后
		bean.setStartupDelay(1);
		return bean;
	}

	@Bean(name = "ipSecurityCheck")
	public IPSecurityCheck ipSecurityCheck() {
		return new IPSecurityCheck();
	}

	@Bean(name = "refererSecurityCheck")
	public RefererSecurityCheck refererSecurityCheck() {
		return new RefererSecurityCheck();
	}

	@Bean(name = "userAgentSecurityCheck")
	public UserAgentSecurityCheck userAgentSecurityCheck() {
		return new UserAgentSecurityCheck();
	}
	
}